/***************************************************************************
 *   Copyright (C) 2008 by Eduardo Gurgel Pinho                            *
 *   edgurgel@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef __GRID_H__
#define __GRID_H__

#include "math/vector.h"

#include <boost/serialization/nvp.hpp>

namespace Sirat {

namespace Common {

enum Grid_Type {
	Hemispherical = 0,
  	Planar,
};
	
class Grid {
public:
	virtual ~Grid();

	unsigned short get_width() const;
	unsigned short get_height() const;
	Math::Vector get_position() const;
	Math::Vector get_x() const;
	Math::Vector get_y() const;
	Math::Vector get_z() const;

	void set_width(const unsigned short&);
	void set_height(const unsigned short&);
	void set_position(const Math::Vector&);
	void set_x(const Math::Vector&);
	void set_y(const Math::Vector&);
	void set_z(const Math::Vector&);
	
	virtual Math::Vector projection_transformation(unsigned int x,unsigned int y) = 0;
	virtual Grid* clone() = 0;
protected:
	Grid(const unsigned short&,const unsigned short&,const Math::Vector&,const Math::Vector&,const Math::Vector&,const Math::Vector&);
	Grid(void);
	Grid(const Grid& _grid);
	
	Grid& operator=(const Grid& _grid);
	
	unsigned short width;
	unsigned short height;
	Math::Vector position;
	Math::Vector x,y,z;
private:
	friend class boost::serialization::access;
	template<class Archive> void serialize(Archive&, const unsigned int);           
};

template<class Archive> void Grid::serialize(Archive& ar, const unsigned int /* file_version */){
	ar	& BOOST_SERIALIZATION_NVP(position)
		& BOOST_SERIALIZATION_NVP(x)	
		& BOOST_SERIALIZATION_NVP(y)
		& BOOST_SERIALIZATION_NVP(z)
		& BOOST_SERIALIZATION_NVP(width)
		& BOOST_SERIALIZATION_NVP(height);              
}

}

}

#endif
